// 测试链接：https://www.luogu.com.cn/problem/P1314
// 请同学们务必参考如下代码中关于输入、输出的处理
// 这是输入输出处理效率较高的写法
// 提交以下的所有代码，可以直接通过

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int MAXN = 200010;
int weight[MAXN];
int value[MAXN];
int n, m;
int left[MAXN], right[MAXN];
LL s, sw[MAXN], sv[MAXN], ans = 1e18;

inline long long read()
{
    char ch = getchar();
    long long x = 0, f = 1;
    while(ch < '0' || ch > '9')
    {
        if(ch == '-') f = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9')
    {
        x = 10 * x + ch - '0';
        ch = getchar();
    }
    return f * x;
}

bool check(int W)
{
    // memset(sw, 0, sizeof sw);
    // memset(sv, 0, sizeof sv);
    for(int i = 1; i <= n; ++i) // 前缀和
    {
        if(weight[i] >= W) sw[i] = sw[i - 1] + 1, sv[i] = sv[i - 1] + value[i];
        else sw[i] = sw[i - 1], sv[i] = sv[i - 1];
    }
    LL y = 0;
    for(int i = 1; i <= m; ++i)
    {
        y += (sw[::right[i]] - sw[::left[i] - 1]) * (sv[::right[i]] - sv[::left[i] - 1]);
    }
    ans = min(ans, llabs(y - s));
    return y <= s; // W变大，则y会变小
}

LL compute()
{
    int l = 0, r = 1e6 + 1, m;
    while(l <= r)
    {
        m = l + ((r - l) >> 1);
        if(check(m)) r = m - 1;
        else l = m + 1; 
    }
    return ans;
}

int main()
{
    n = read(), m = read(), s = read();
    for(int i = 1; i <= n; ++i)
    {
        weight[i] = read(), value[i] = read();
    }
    for(int i = 1; i <= m; ++i)
    {
        ::left[i] = read(), ::right[i] = read();
    }
    printf("%lld\n", compute());

    return 0;
}